<%--
  Created by IntelliJ IDEA.
  User: Jamin
  Date: 2019/1/19
  Time: 14:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


<head>
    <meta charset="UTF-8">
    <title>${登录}</title>
    <link rel="stylesheet" href="../../css/bootstrap.css">
    <link rel="stylesheet" href="../../css/admin.css">
    <link rel="stylesheet" href="../../css/style.css">
    <script src="../../js/jquery.min.3.1.0.js"></script>
    <script src="../../layuiadmin/layui/layui.all.js"></script>
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
</head>

<header class="pay-header login">
    <a href="/${contextPath}" class="logo">
        <img src="../../images/logo2.png">
    </a>
</header>

<main class="login">
    <div class="login-content">
        <form method="post" action="" id="form" name="form" class="layui-form">
            <div class="login-frame">
                <div class="login-tip">密码登录</div>
                <div class="login-input">
        <span class="login-input-icon">
                    <span class="glyphicon-user"></span>
                </span>
                    <input type="text" placeholder="账号" name="name" id="name" lay-verify="account">
                </div>
                <div class="login-input">
                <span class="login-input-icon ">
                    <span class=" glyphicon glyphicon-lock"></span>
                </span>
                    <input type="password" placeholder="密码" name="password" id="password" lay-verify="password">
                    <input type="hidden" name="refer" id="refer">
                </div>
                <div class="login-button">
                    <button class="layui-btn" lay-submit="" lay-filter="login">登 录</button>
                </div>
                <div class="login-bottom">
                    <a href="ForgetPassword.jsp">忘记登录密码</a>
                    <a class="" href="Register.jsp">免费注册</a>
                </div>
            </div>
        </form>
    </div>
</main>
<footer class="footer-bottom">
    <div class="foot-content login">
        <div class="copyright" id="copyright">
            <div class="white-link login-text">
                <a>关于天猫</a>
                <a>帮助中心</a>
                <a>开放平台</a>
                <a> 诚聘英才</a>
                <a>联系我们</a>
                <a>网站合作</a>
                <a>法律声明</a>
                <a>知识产权</a>
                <a>廉正举报 </a>
            </div>
            <div class="white-link login-text">
                <a> 阿里巴巴集团</a><span class="slash">|</span>
                <a> 淘宝网</a><span class="slash">|</span>
                <a>天猫 </a><span class="slash">|</span>
                <a> 聚划算</a><span class="slash">|</span>
                <a>全球速卖通</a><span class="slash">|</span>
                <a>阿里巴巴国际交易市场</a><span class="slash">|</span>
                <a>1688</a><span class="slash">|</span>
                <a>阿里妈妈</a><span class="slash">|</span>
                <a> 阿里旅行·去啊 </a><span class="slash">|</span>
                <a> 阿里云计算 </a><span class="slash">|</span>
                <a> 友盟 </a><span class="slash">|</span>
                <a> 虾米 </a><span class="slash">|</span>
                <a> 天天动听 </a><span class="slash">|</span>
                <a> 来往 </a><span class="slash">|</span>
                <a> 钉钉 </a><span class="slash">|</span>
                <a> 支付宝 </a>
            </div>
            <div class="license">
                <span>增值电信业务经营许可证： <a>浙B2-20110446</a></span>
                <span>网络文化经营许可证：<a>浙网文[2015]0295-065号</a></span>
                <span><a>12318举报 </a></span><br>
                <span>互联网药品信息服务资质证书编号：<a>浙-（经营性）-2012-0005</a></span>
                <div class="copy-right-year">© 2003-2017 TMALL.COM 版权所有</div>

            </div>
        </div>
    </div>
</footer>

<script type="text/javascript">
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit

        //自定义验证规则
        form.verify({
            account: function (value) {
                if (value.length == 0) {
                    return '账号不得为空';
                }
            }
            , password: function (value) {
                if (value.length == 0) {
                    return '密码不得为空';
                }
            }


        });


        //监听提交
        form.on('submit(login)', function (data) {
            $.ajax({
                type: "POST",//方法类型
                dataType: "json",//预期服务器返回的数据类型
                url: "/LoginServlet",//url
                data: $('#form').serialize(),
                success: function (data) {

                    if (data.login) {
                      alert("登录成功");
                        window.location.href = "/DisplayServlet";
                    } else {
                      alert("用户名或密码错误");
                        window.location.href = "Login.jsp";
                    }

                }
            });


            return false;
        });


    });
</script>
